package 第二章数据结构.哈希表.id840模拟散列表;
/**
 * 最优解法可以参考jdk的HashMap源码
 */

import java.util.Scanner;

public class Main {
    static MyHashMap hashMap = new MyHashMap();
    public static void main(String[]args){
        Scanner scanner = new Scanner(System.in);
        int n = scanner.nextInt();
        scanner.nextLine();
        while(n -- > 0){
            String s = scanner.nextLine();
            String[] op =  s.split(" ");
            int x = Integer.parseInt(op[1]);
            if(op[0].equals("I")){
                hashMap.insert(x);
            }else if(op[0].equals("Q")){
                if(hashMap.query(x))System.out.println("Yes");
                else System.out.println("No");
            }
        }
    }

    static class MyHashMap{
        static Node[] arrays = new Node[100001];
        static int hash(int x){
            return (x % arrays.length + arrays.length) % arrays.length;
        }
        //插入
        static void insert(int x){
            int hash = hash(x);
            if(arrays[hash] != null){
                Node cur = arrays[hash];
                while (cur != null){
                    if(cur.val == x){
                        return;
                    }
                    if(cur.next == null){
                        cur.next = new Node(x);
                        return;
                    }
                    cur = cur.next;
                }
            }else {
                arrays[hash] = new Node(x);
            }
        }
        //查询
        static boolean query(int x){
            int hash = hash(x);
            if(arrays[hash] == null){
                return false;
            }
            Node cur = arrays[hash];
            while (cur != null){
                if(cur.val == x)return true;
                cur = cur.next;
            }
            return false;
        }
    }

    static class Node{
        int val;
        Node next;
        Node(int val){
            this.val = val;
        }
    }
}
